<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use \yii\helpers\Url;

/* @var $class array */
/* @var $this yii\web\View */
/* @var $model backend\models\Banner */
/* @var $form yii\widgets\ActiveForm */
?>
<div class = "banner-form">
    <?php $form = ActiveForm::begin()?>
    <?= $form->field( $model , 'image' )->widget( 'manks\FileInput' , [
        'clientOptions' => [
            'fileSingleSizeLimit' => 1024 * 1024 * 1 ,
            'server'              => Url::to( [ 'base/banner-img' ] ) ,
        ] ,
    ] ); ?>
    <?= $form->field( $model , 'is_display' )->radioList( ['1' => '显示' , '2' => '不显示' ] ) ?>
    <div class = "form-group">
        <?= Html::submitButton( $model->isNewRecord ? '创建' : '更新' , [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ] ) ?>
    </div>
    <?php ActiveForm::end(); ?>
</div>
<script>
    $(function () {
        $('#banner-image').attr({
            'readonly': 'readonly',
            'placeholder': '请上传340x340或宽高比为1：1图片(1M以内的gif,jpg,jpeg,bmp,png格式）'
        });
        $('.cus-img').css('height','80px');
    });
</script>


